﻿<?php
('Access-Control-Allow-Origin：*');
include("../config/mysql.php");
$projectName = $_GET["projectName"];
$limit = $_REQUEST['limit'];
$page = $_REQUEST['page'];
$rponame = $_GET["rponame"];
$typeLo = $_GET["typeLo"];
$typephj = $_GET["typephj"];
$company_id = $_GET["company_id"];
$sql = "SELECT r.Id,r.rid,r.produ,r.produIntroduce,r.price,r.Agencyprice,r.type,e.name AS educationtype_name,r.validYear,r.remarks,r.Externalprice,re.companyName FROM resourcedetails r INNER JOIN resource re ON r.rid=re.Id INNER JOIN educationtype e ON r.type = e.id WHERE r.company_id = {$company_id} AND r.produ LIKE '%{$rponame}%' AND r.rid LIKE '%{$typeLo}%'";
if ($typephj) {
	$sql .= " AND r.type = {$typephj}";
}
$sql .= " ORDER BY id DESC";
$Mysql = new Mysql();
$count = $Mysql->getResultNum($sql);
$start = ($page - 1) * $limit;
$sql .= " limit {$start},{$limit}";
/*查询表格参数一表明   参数二 查询语句*/
$arr = $Mysql->likeSelectLayui($sql);
/*返回出去*/
if (is_array($arr) == 1) {
	$res = [
		'code' => 0,
		'msg' => '查询成功',
		'count' => $count,
		'data' => $arr
	];
} else {
	$res = [
		'msg' => '没有查到数据',
	];
}
echo json_encode($res, JSON_UNESCAPED_UNICODE);
/*关闭连接*/
$Mysql->close();
